package com.allwees.bs.module.oms.rest;


import com.allwees.bs.core.modelbase.vo.R;
import com.allwees.bs.module.core.dynamic.annotation.DynamicInject;
import com.allwees.bs.module.core.dynamic.annotation.MultiDynamicInject;
import com.allwees.bs.module.oms.entity.OrderItem;
import com.allwees.bs.module.oms.service.GeneralOrderItemService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/backstage/api/oms/o_order_item")
public class GeneralOrderItemApi extends BaseOrderItemApi<GeneralOrderItemService> {


    @MultiDynamicInject(value = {
            @DynamicInject(type = DynamicInject.Type.Retailer, key = "retailerUuid"),
            @DynamicInject(key = "uuid")
    })
    @GetMapping("/find_by_order_uuid/{orderUuid}")
    public R findByOrderUuid(@PathVariable String orderUuid) {
        List<OrderItem> orderItems = boService.findByOrderUuid(orderUuid);
        return R.ok(orderItems);
    }
}
